package com.doge.walknovel.core.account

import com.google.android.gms.auth.api.signin.GoogleSignInAccount

data class GoogleUser(
    val nickname: String?,
    val avatarUrl: String?,
    val email: String?,
    val displayName: String?,
    val uid: String?,
    val idToken: String?
) {
    companion object {
        fun from(data: GoogleSignInAccount?): GoogleUser? {
            if (data == null) return null
            return GoogleUser(
                nickname = data.account?.name,
                avatarUrl = data.photoUrl?.toString(),
                email = data.email,
                displayName = data.displayName,
                uid = data.id,
                idToken = data.idToken,
            )
        }
    }
}